package com.example.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @projectName: eureka_demo1
 * @package: com.example.user.controller
 * @className: UserController
 * @author: yangtongtong
 * @description: TODO
 * @date: 2023/7/24 15:07
 * @version: 1.0
 */


@RestController
@RequestMapping("/user")
public class UserController {


    private final Environment environment;
    @Autowired
    public UserController(Environment environment) {
        this.environment = environment;
    }

    @GetMapping("/hello")
    public String hello(){
        String port = environment.getRequiredProperty("server.port");
        System.out.println(port);
        return "hello, i am user";
    }

}
